package com.itheima.day05.myarrays.test1;

import java.util.Arrays;

public class Test {
    public static void main(String[] args) {
        int[] arr = {9,5,2,7,3};
//        public static String toString​(int[] a)	返回指定数组的内容的字符串表示形式
        System.out.println(Arrays.toString(arr));
//        public static void sort​(int[] a)	按照数字顺序排列指定的数组
        Arrays.sort(arr);
        System.out.print("[");
        for (int i = 0; i < arr.length - 1; i++) {
            System.out.print(arr[i] + ", ");
        }
        System.out.print(arr[arr.length - 1]);
        System.out.println("]");
//        public static int binarySearch​(int[] a, int key)	利用二分查找返回指定元素的索引
        int index = Arrays.binarySearch(arr, 1);
        System.out.println(index);
    }
}
